home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / ohlutil / cp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-24  |  4.8 KB  |  183 lines

  1. /*  cp.h  -- file copying (data definitions)
  2.     Copyright (C) 1989, 1990 Free Software Foundation.
  3.     ChangeLog: ChangeLog
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 1, or (at your option)
  8.     any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     Written by Torbjorn Granlund, Sweden (tege@sics.se). */
  20.  
  21. /*
  22.  * MS-DOS port (c) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  23.  *
  24.  * To this port, the same copying conditions apply as to the
  25.  * original release.
  26.  *
  27.  * IMPORTANT:
  28.  * This file is not identical to the original GNU release!
  29.  * You should have received this code as patch to the official
  30.  * GNU release.
  31.  *
  32.  * MORE IMPORTANT:
  33.  * This port comes with ABSOLUTELY NO WARRANTY.
  34.  *
  35.  * $Header: e:/gnu/fileutil/RCS/cp.h'v 1.3.0.2 90/06/29 00:37:34 tho Stable $
  36.  */
  37.  
  38. #include <sys/types.h>
  39.  
  40. #include "system.h"
  41.  
  42. struct dir_list
  43. {
  44.   struct dir_list *parent;
  45.   ino_t ino;
  46.   dev_t dev;
  47. };
  48.  
  49. struct entry
  50. {
  51.   ino_t ino;
  52.   dev_t dev;
  53.   char *node;            /* Path name, or &new_file for new inodes.  */
  54.   struct entry *coll_link;    /* 0 = entry not occupied.  */
  55. };
  56.  
  57. struct htab
  58. {
  59.   unsigned modulus;        /* Size of the `hash' pointer vector.  */
  60.   struct entry *entry_tab;    /* Pointer to dynamically growing vector.  */
  61.   unsigned entry_tab_size;    /* Size of current `entry_tab' allocation.  */
  62.   unsigned first_free_entry;    /* Index in `entry_tab'.  */
  63.   struct entry *hash[1];    /* Vector of pointers in `entry_tab'.  */
  64. };
  65.  
  66. extern int exit_status;
  67. extern struct htab *htab;
  68.  
  69. #ifdef MSDOS
  70. extern  char *xmalloc (unsigned int );
  71. extern  char *xrealloc (char *, unsigned int);
  72. extern  void forget_all (void);
  73. extern  int copy_reg (char *, char *);
  74. extern  void hash_init (unsigned int, unsigned int);
  75. extern  int remember_created (char *);
  76. extern  char *remember_copied (char *, unsigned short, short);
  77. #endif /* MSDOS */
  78.  
  79. extern char *xmalloc ();
  80. extern char *xrealloc ();
  81. extern void forget_copied ();
  82. extern void forget_all ();
  83. extern int copy_reg ();
  84. extern void hash_init ();
  85. extern char *remember_copied ();
  86. extern int remember_created ();
  87.  
  88. /* For created inodes, a pointer in the search structure to this
  89.    character identifies that the inode as new.  */
  90. extern char new_file;
  91.  
  92. #ifdef MSDOS
  93. extern  void main (int, char **);
  94. extern  void usage (char *);
  95. extern  void error (int status, int errnum, char *message, ...);
  96. extern  int yesno (void);
  97. extern  char *str_cpy (char *, char *);
  98. extern  int user_confirm_overwriting (char *);
  99. extern  int member (int);
  100. extern  int do_copy (int, char **);
  101. extern  int copy (char *, char *, int, short, struct dir_list *);
  102. extern  int copy_dir(char *,char *,int,struct stat *,struct dir_list *);
  103. extern  void strip_trailing_slashes (char *path);
  104. extern  int is_ancestor (struct stat *, struct dir_list *);
  105. #endif /* MSDOS */
  106.  
  107. extern void error ();
  108. extern void usage ();
  109. extern char *savedir ();
  110. extern char *str_cpy ();
  111. extern int yesno ();
  112. extern int do_copy ();
  113. extern int copy ();
  114. extern int copy_dir ();
  115. extern void strip_trailing_slashes ();
  116. extern int is_ancestor ();
  117.  
  118. /* System calls.  */
  119.  
  120. #ifdef MSDOS
  121.  
  122. #include <direct.h>
  123. #include <io.h>
  124. #include <malloc.h>
  125. #include "msd_pwd.h"
  126.  
  127. #define    link( a, b)    (-1)
  128.  
  129. #define ftruncate    chsize
  130. extern  int eaccess_stat (struct stat *statp, int mode);
  131.  
  132. #else /* not MSDOS */
  133.  
  134. extern int mknod ();
  135.  
  136. #ifdef _POSIX_SOURCE
  137. #define S_IWRITE S_IWUSR
  138. #define S_IEXEC S_IXUSR
  139. #else
  140. extern int open ();
  141. extern int close ();
  142. extern int fstat ();
  143. extern int stat ();
  144. extern int lstat ();
  145. extern int read ();
  146. extern int write ();
  147. extern int symlink ();
  148. extern int readlink ();
  149. extern int mkdir ();
  150. #if 0                /* Breaks on SunOS 4.1. */
  151. extern int umask ();
  152. #endif
  153. extern int unlink ();
  154. extern int link ();
  155. extern int chmod ();
  156. extern int chown ();
  157. extern int fchmod ();
  158. extern int access ();
  159. extern int utime ();
  160. extern int ftruncate ();
  161. extern int isatty ();
  162. extern off_t lseek ();
  163. #endif
  164.  
  165. #endif /* not MSDOS */
  166.  
  167. /* Library calls.  */
  168. #include <errno.h>
  169. #ifdef STDC_HEADERS
  170. #include <stdlib.h>
  171. #else
  172. extern char *getenv ();
  173. extern char *malloc ();
  174. extern char *realloc ();
  175. extern int free ();
  176. extern void exit ();
  177. extern int fprintf ();
  178. extern int fputs ();
  179. extern int printf ();
  180.  
  181. extern int errno;
  182. #endif
  183.